package com.chlitina.store.modules.cash.entity;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.chlitina.store.common.persistence.BaseEntity;
import com.chlitina.store.modules.base.entity.Customer;
import com.chlitina.store.modules.sys.entity.Store;

/**
 * 店面消费 Entity
 * @author Songsong.XU
 * @version 2013-11-07
 */
@Entity
@Table(name = "store_consume")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class StoreConsume extends BaseEntity {
	public static final int TYPE_UNCONFIRMED = 0; //未确认
	public static final int TYPE_CONFIRMED = 1;//已确认
	public static final int TYPE_CONSUME_MEMBER = 0; //会员消费
	public static final int TYPE_CONSUME_NOMEMBER = 1;//散客消费
	public static final int TYPE_SATISFACTIOIN_0 = 0;//未评价
	public static final int TYPE_SATISFACTIOIN_1 = 1;// 非常满意
	public static final int TYPE_SATISFACTIOIN_2 = 2;// 较满意
	public static final int TYPE_SATISFACTIOIN_3 = 3;// 一般
	public static final int TYPE_SATISFACTIOIN_4 = 4;//不太满意
	public static final int TYPE_SATISFACTIOIN_5 = 5;//非常不满意
	
	private static final long serialVersionUID = 1L;
	private Long id; 		// 编号
	private String consume_Number;//消费编码
	private Store store; 	// 店面
	private Customer customer;//会员
	private Date consume_Time;//消费时间
	private float money_To_Pay;//应付现金
	private String verify_Code;//验证码
	private int confirmed;//确认状态
	private int satisfaction;//满意度服务满意度客户评价：0： 未评价1： 非常满意2： 较满意3： 一般4：不太满意5：非常不满意
	private int consume_Type;//消费类型
	 
	public StoreConsume() {
	}

	public StoreConsume(Long id){
		this();
		this.id = id;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}
	
	public String getConsume_Number() {
		return consume_Number;
	}

	public void setConsume_Number(String consume_Number) {
		this.consume_Number = consume_Number;
	}
	public Date getConsume_Time() {
		return consume_Time;
	}

	public void setConsume_Time(Date consume_Time) {
		this.consume_Time = consume_Time;
	}

	public String getVerify_Code() {
		return verify_Code;
	}

	public void setVerify_Code(String verify_Code) {
		this.verify_Code = verify_Code;
	}

	public int getConsume_Type() {
		return consume_Type;
	}

	public void setConsume_Type(int consume_Type) {
		this.consume_Type = consume_Type;
	}
	
	@ManyToOne(cascade={CascadeType.REFRESH}, fetch = FetchType.LAZY) 
	@JoinColumn(name="CUSTOMER_ID")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public int getConfirmed() {
		return confirmed;
	}

	public void setConfirmed(int confirmed) {
		this.confirmed = confirmed;
	}

	public int getSatisfaction() {
		return satisfaction;
	}

	public void setSatisfaction(int satisfaction) {
		this.satisfaction = satisfaction;
	}

	@ManyToOne(cascade={CascadeType.REFRESH}, fetch = FetchType.LAZY) 
	@JoinColumn(name="STORE_ID")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public Store getStore() {
		return store;
	}

	public void setStore(Store store) {
		this.store = store;
	}

	public float getMoney_To_Pay() {
		return money_To_Pay;
	}

	public void setMoney_To_Pay(float money_To_Pay) {
		this.money_To_Pay = money_To_Pay;
	}
}


